import { DeleteDto, IndexDto, ShowDto } from '@libs/common/dto';
import { ApiProperty, PartialType } from '@nestjs/swagger';
import { IsBoolean, IsNotEmpty, IsNumber } from 'class-validator';

import { Overtime } from '../entities/overtime.entity';

export class IndexOvertimeDto extends IndexDto<Overtime> {}

export class ShowOvertimeDto extends ShowDto {}

export class DeleteOvertimeDto extends DeleteDto {}

export class CreateOvertimeDto {
  @ApiProperty({ description: '钉钉ID' })
  @IsNotEmpty({ message: '钉钉ID不能为空' })
  dingId: string;

  @ApiProperty({ description: '用户ID' })
  @IsNotEmpty({ message: '用户ID不能为空' })
  userId: string;

  @ApiProperty({ description: '用户名' })
  @IsNotEmpty({ message: '用户名不能为空' })
  userName: string;

  @ApiProperty({ description: '已用时长/单位分钟' })
  @IsNotEmpty({ message: '已用时长/单位分钟' })
  @IsNumber({}, { message: '已用时长/单位分钟必须为数字' })
  usedTime: number;

  @ApiProperty({ description: '剩余时长/单位分钟' })
  @IsNotEmpty({ message: '剩余时长/单位分钟' })
  @IsNumber({}, { message: '剩余时长/单位分钟必须为数字' })
  remainTime: number;

  @ApiProperty({ description: '总计时长/单位分钟' })
  @IsNotEmpty({ message: '总计时长/单位分钟' })
  @IsNumber({}, { message: '总计时长/单位分钟必须为数字' })
  totalTime: number;
}

export class UpdateOvertimeDto extends PartialType(CreateOvertimeDto) {
  @ApiProperty()
  @IsNotEmpty({ message: 'id 不能为空' })
  id: string;
}

export class FindOvertimeDto extends PartialType(UpdateOvertimeDto) {}

export class SwitchOvertimeDto {
  @ApiProperty()
  @IsNotEmpty({ message: 'id 不能为空' })
  id: string;

  @ApiProperty({ description: '状态' })
  @IsNotEmpty({ message: '状态不能为空' })
  @IsBoolean()
  status: boolean;
}

export class ImportOvertimeDto {}

export class ExportOvertimeDto {}
export class SyncOvertimeDto {
  @IsNotEmpty({ message: 'dingId不能为空' })
  dingId: string;
}
export class FindOneByIdOvertimeDto {
  @IsNotEmpty({ message: 'dingId不能为空' })
  dingId: string;
}
